package com.xdd.app01;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity implements View.OnClickListener, MyFragment1.ICallBack {

    private Button btn_main_download;
    private Button btn_main_handler;

    public MainActivity() {
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        btn_main_download = findViewById(R.id.btn_main_download);
        btn_main_handler = findViewById(R.id.btn_main_handler);
        btn_main_download.setOnClickListener(this);
        btn_main_handler.setOnClickListener(this);

        MyFragment1 myFragment1 = new MyFragment1();
        myFragment1.getData(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_main_download:

//               Intent intent= new Intent("com.android.contacts/.activities.DialtactsActivity");
//               startActivity(intent);

                btn_main_download.setText("下载中。。。");
                Toast.makeText(this, "下载中", Toast.LENGTH_SHORT).show();
                break;

            case R.id.btn_main_handler:
                startActivity(new Intent(this, HandlerActivity.class));
                break;
        }

    }

    @Override
    public void getResult(String result) {

    }
}
